package CodeTwo;

import java.util.Scanner;

/** @author ASUS */
public class Missiledefensesystem {
  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    int n;
    n = scan.nextInt();
    int[] a = new int[26];
    int[] b = new int[26];
    int max = 0;

    for (int i = 0; i < n; i++) {
      a[i] = scan.nextInt();
      b[i] = 1;
    }
    scan.close();

    for (int i = 0; i < n; i++) {
      for (int j = 0; j < i; j++) {
        // j在i前面，且j比i高，则可以考虑是否捕捉i，若j处捕获数+1大于i处，则更新b[i]
        if (a[i] <= a[j] && b[j] + 1 > b[i]) {
          b[i] = b[j] + 1;
        }
      }
      // 更新max
      if (b[i] > max) {
        max = b[i];
      }
    }
    System.out.print(max);
  }
}
